<h1>Freight Invoice Document</h1>
<?php 
    if($freightinvoice){$data = $freightinvoice['data'];$lineitems = $freightinvoice['lineitem'];
        if($data->PaymentStatus==ACTION_NOACTION){$action = 'Not approved yet';}
        if($data->PaymentStatus==ACTION_APPROVE){$action = 'Approved';}
        if($data->PaymentStatus==ACTION_REJECT){$action = 'Rejected';}
    ?>
<fieldset>
<legend>Data</legend>
<table>
    <tr>
        <td><label>Creation Date</label></td>
        <td><label><?php echo $data->CreationDate;?></label></td>
        <td>No Freight Invoice</td>
        <td><label><?php echo $data->FINumber;?></label></td>
    </tr>
    <tr>
        <td><label>Payment Status</label></td>
        <td><label><?php echo $action;?></label></td>
        <td><label></label></td>
        <td><label></label></td>
    </tr>
    <tr>
        <td>Shipper</td>
        <td><label><?php echo $data->SLName;?></label></td>
        <td>Consignee</td>
        <td><label><?php echo $data->CName;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->SLAddress;?></label></td>
        <td></td>
        <td><label><?php echo $data->CAddress;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->SLTelp;?></label></td>
        <td></td>
        <td><label><?php echo $data->CTelp;?></label></td>
    </tr>
    <tr>
        <td>Notify Party</td>
        <td><label><?php echo $data->NPName;?></label></td>
        <td>Forwarder</td>
        <td><label><?php echo $data->FName;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->NPAddress;?></label></td>
        <td></td>
        <td><label><?php echo $data->FAddress;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->NPTelp;?></label></td>
        <td></td>
        <td><label><?php echo $data->FTelp;?></label></td>
    </tr>
    <tr>
        <td>Precarriage</td>
        <td><label><?php echo $data->Precarriage;?></label></td>
        <td>Place of Receipt</td>
        <td><label><?php echo $data->PlaceOfReceipt;?></label></td>
    </tr>
    <tr>
        <td>Vessel</td>
        <td><label><?php echo $data->Vessel;?></label></td>
        <td>Port of Loading</td>
        <td><label><?php echo $data->PortOfLoading;?></label></td>
    </tr>
    <tr>
        <td>Port of Discharge</td>
        <td><label><?php echo $data->PortOfDischarge;?></label></td>
        <td>Place of Delivery</td>
        <td><label><?php echo $data->PlaceOfDelivery;?></label></td>
    </tr>
    <tr>
        <td>Total Freight Prepaid</td>
        <td><label><?php echo $data->TotalFreightPrepaid;?></label></td>
        <td>Total Freight Collect</td>
        <td><label><?php echo $data->TotalFreightCollect;?></label></td>
    </tr>
    <tr>
        <td>Total Freight</td>
        <td><label><?php echo $data->TotalFreight;?></label></td>
        <td></td>
        <td></td>
    </tr>
</table>
</fieldset>
<fieldset>
    <legend>Container</legend>
        <table>
            <tr>
                <td>Container No</td>
                <td>Kind Package</td>
                <td>Gross Weight</td>
                <td>Nett Weight</td>
                <td>Measurement</td>
                <td>Detail</td>
                <td>Total Package</td>
            </tr>
            <?php foreach($lineitems as $lineitem){ 
                $containerdetails = $lineitem->ContainerDetail;?>
            <tr>
                <td><?php echo $lineitem->ContainerNo;?></td>
                <td><?php echo $lineitem->KindPackage;?></td>
                <td><?php echo $lineitem->GrossWeight;?></td>
                <td><?php echo $lineitem->NettWeight;?></td>
                <td><?php echo $lineitem->Measurement;?></td>
                <td>
                   <?php foreach($containerdetails as $containerdetail){
                       echo $containerdetail->QuantityPackage. ' '.$containerdetail->Description.' ('.$containerdetail->Rate.' @ '.$containerdetail->Charges.')';
                       echo '</br>';
                   }?>
                </td>
                <td><?php echo $lineitem->TotalPackage;?></td>
            </tr>
            <?php } ?>
        </table>
    </fieldset>
<br/>
<?php } ?>
    